package cn.xsw.entity.query;

import cn.hutool.core.util.StrUtil;
import cn.xsw.common.MyException;
import cn.xsw.entity.Business;
import cn.xsw.entity.Comment;
import cn.xsw.utils.BaseQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class CommentQuery extends BaseQuery<Comment> {
    @ApiModelProperty(value = "文章id",example = "0")
    private Integer aid;
    public CommentQuery(){
        this.aid = 0;
    }

    // 条件
    public QueryWrapper wrapper() {
        QueryWrapper<Business> wrapper = new QueryWrapper<>();
        if (aid<=0) throw new MyException(-1,"用户id不合法",null);
        wrapper.eq("aid", this.aid);
        return wrapper;
    }
}
